package com.cj;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @author cc
 * @date 2025-05-12 20:24
 **/

public class WindowsCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {

        // 当前操作系统的名字
        String osName = context.getEnvironment().getProperty("os.name");
        return osName.toLowerCase().contains("windows");
    }
}
